export const state = () => {
  return {
    is_show_history: true, //是否显示历史账单 或 其它月份账单
    current_bill_page: "history", //history: 历史；last: 已出账单； this: 未出账单
    last_year_day: "",
    lastMonth: "6",
    this_year_day: "",
    thisMonth: "7",
    bill_month_title: "2018-12", //已出账单
    unbill_month_title: "2019-01", //未出账单
    bill_month_tips: "已还清", //当前详情月 账单描述
    unbill_month_tips: "未还清", //
    //最近的 已出账单
    bill_guess_params: {
      text: "未还清",
      month: "2018-11",
      end_day: "12.03",
      start_day: "11.03"
    },
    //未出账单
    unbill_guess_params: {
      text: "未还清",
      month: "2018-11",
      end_day: "12.03",
      start_day: "11.03"
    },
    amount_currency: [
      {
        //
        name: "人民币",
        amount: "25.4931"
      }
    ],
    //我的帐单
    my_bill: {
      code: 0,
      msg: "OK",
      data: {
        total: "1",
        guess_params: {
          text: "未还清",
          month: "2018-11",
          end_day: "12.03",
          start_day: "11.03"
        },
        list: [
          // {
          //   amount: "25.4931 CNY",
          //   unpay_amount: "25.4931 CNY",
          //   name: "人民币"
          // }
        ]
      }
    },
    //账单历史
    bill_history: {
      code: 0,
      msg: "OK",
      data: {
        total: "3",
        list: [
          {
            bill_monthly: "2018-11",
            amount_currency: [
              {
                name: "人民币",
                amount: "25.4931"
              }
            ],
            status_str: "已还清",
            status: "1"
          },
          {
            bill_monthly: "2018-10",
            amount_currency: [
              {
                name: "人民币",
                amount: "0"
              }
            ],
            status_str: "已还清",
            status: "1"
          },
          {
            bill_monthly: "2018-09",
            amount_currency: [
              {
                name: "人民币",
                amount: "0"
              }
            ],
            status_str: "已还清",
            status: "1"
          }
        ]
      }
    },
    //某月份账单流水详情
    bill_month_details: {
      code: 0,
      msg: "OK",
      data: {
        total: "3",
        list: [
          {
            bill_id: "1810311835176070299",
            type: "1",
            amount: "-7.7474",
            addtime: "1540982117",
            type_str: "支付订单",
            currency_code: "CNY"
          },
          {
            bill_id: "1810311821157916508",
            type: "1",
            amount: "-7.7457",
            addtime: "1540981274",
            type_str: "支付订单",
            currency_code: "CNY"
          },
          {
            bill_id: "1810311635183377005",
            type: "1",
            amount: "-10.0000",
            addtime: "1540974918",
            type_str: "支付订单",
            currency_code: "CNY"
          }
        ]
      }
    }
  };
};

export const mutations = {
  SET_is_show_history(state, bool) {
    state.is_show_history = bool;
  },
  SET_current_bill_page(state, str) {
    state.current_bill_page = str;
  },
  SET_bill_month_title(state, bill_month_title) {
    state.bill_month_title = bill_month_title;
  },
  SET_bill_month_tips(state, bill_month_tips) {
    state.bill_month_tips = bill_month_tips;
  },
  SET_unbill_month_tips(state, bill_month_tips) {
    state.unbill_month_tips = bill_month_tips;
  },
  SET_amount_currency(state, arr) {
    state.amount_currency = arr;
  },
  SET_last_year_day(state, month) {
    state.last_year_day = month;
  },
  SET_lastMonth(state, month) {
    state.lastMonth = month;
  },
  SET_this_year_day(state, month) {
    state.this_year_day = month;
  },
  SET_thisMonth(state, month) {
    state.thisMonth = month;
  },
  SET_bill_guess_params(state, data) {
    state.bill_guess_params = data;
  },
  SET_unbill_guess_params(state, data) {
    state.unbill_guess_params = data;
  },
  set_my_bill(state, bill) {
    state.my_bill = bill;
  },
  set_bill_history(state, bill) {
    state.bill_history = bill;
  },
  set_bill_month_details(state, bill) {
    state.bill_month_details = bill;
  }
};

export const getters = {};

export const actions = {
  // async GET_AREA_CODE ({ commit }){
  //   try {
  //     let data = await this.$axios.get('/area_code.json');
  //     console.log(data);
  //   } catch (e) {
  //     throw e;
  //   }
  // }
};
